<?php
//echo "<pre>";
//print_r($courses);
//echo "</pre>";
//die();
?>
<?php if (!empty($courses)) { ?>
<?php echo $this->load->view("schedule/course_nav"); ?>

<br />
  <div class="din pel xleft"><?php echo $courses['courses_name']['kode_pelatihan']; ?></div>
  <?php  //next course
  if($courses['next_status']) {?>
  <?php $next = $courses['courses_list'][$courses['next']];?>
  <div class="pelkanan">
		<p class="jad2 din">Up Next:</p>
		<p class="jad2 ">
			<span class="sesi0 din">Sesi-<?php echo $next['nomor_sesi'] ?></span>
		</p>
	</div>
	<div class="pelkanan">
		<p class="jad2 din "><?php echo $next['judul_sesi']; ?></p>
		<p class="jad3"><?php echo date("d-F-Y", strtotime($next['tanggal'])); ?> | <?php echo $next['jam_mulai']."-".$next['jam_selesai']?> | <?php echo $next['nama_ruangan']; ?></p>
		<p class="jad4">
			<?php foreach ($next['list_pengajar'] as $row) {
				echo $row['nama']." | ";
			}?>
		</p>
	</div>
  <?php }?>

  <p class="din pel2big clear"><?php echo $courses['courses_name']['nama_pelatihan']; ?></p>
  <p class="din pel3">Angkatan- <?php echo $courses['courses_name']['angkatan']; ?></p>
	<div id="detail">
		<div class="selubung">
			<p class="kanan1 din">Jadwal</p>
			<?php foreach ($courses['courses_schedule'] as $row) { ?>
			<p class="kanan2">
				<?php echo $this->courses->decode_date($row['hari']).", ".$this->courses->decode_time_min($row['course_min_time'])." - ".$this->courses->decode_time_max($row['course_max_time']).", ".$row['nama_ruangan']; ?>
			</p>
			<?php }?>
		</div>
		<div class="selubung">
			<p class="kanan1 din">Pengajar</p>
			<?php foreach ($courses['trainer_list'] as $value) {
				echo "<p class='kanan2'>".$value['nama']."</p>";
			} ?>
		</div>
		<div class="selubung">
			<p class="kanan1 din">Progress</p>

			<div class="kanan3 xleft"><?php echo round( (($courses['pelatihan_selesai'])/$courses['jum_pelatihan']*100), 2);?>%</div>
			<div class="xleft bar2">
			<table width="120" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<?php for($i=0; $i < $courses['pelatihan_selesai']; $i++) {?>
					<td class="done"></td>
					<?php }?>
					<?php for($i=0; $i < ($courses['jum_pelatihan']-$courses['pelatihan_selesai']);$i++){?>
					<td class="yet"></td>
					<?php }?>
				</tr>
			</table>
		</div>
			<p class="clear"></p>
			<p class="kanan2"><?php echo $courses['pelatihan_selesai']; ?> of <?php echo $courses['jum_pelatihan']; ?> Finnished</p>
		</div>
		<div class="clear"></div>
	</div>

  <div class="clear"></div>
	<div id="isibawah">

		<h2 class="trigger din">
      <a href="#">All Schedule:</a>
		</h2>

	<div class="toggle_container">
      <div id="isibawahbor">
      <?php //list all course
	  foreach ($courses['courses_list'] as $row) { ?>
	<div class="jad0">
		<p class="jad1">Sesi-<span class="round">
		<?php echo $row['nomor_sesi']; ?></span> <?php echo date("d-F-Y", strtotime($row['tanggal'])); ?>
		  <span class="black">- <?php echo $row['status']; ?></span>
		</p>
		<p class="jad2 din"><?php echo $row['judul_sesi']; ?></p>
		<p class="jad3"><?php echo $row['jam_mulai']."-".$row['jam_selesai']; ?></p>
		<p class="jad4">
			<?php foreach ($row['list_pengajar'] as $pengajar) {
			  echo $pengajar['nama']." | ";
		  }?>
		</p>
	</div>
      <?php }?>

			</div>
		</div>
	</div>
<?php
} else {
	$this->flash_message->info('Course don\'t have schedule or Course ID not specified');
	redirect('schedule/schedule_con/course');
}
?>